<include file="public@header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a >举报列表</a></li>
		</ul>
        
        <form class="well form-inline margin-top-20" method="post" action="{:url('Dynamicreport/index')}">
            状态：
            <select class="form-control" name="status" style="width: 100px;">
                <option value=''>全部</option>
                <option value="0" <if condition="input('request.status') neq '' && input('request.status') eq 0">selected</if>>未处理</option>
                <option value="1" <if condition="input('request.status') neq '' && input('request.status') eq 1">selected</if>>已处理</option>

            </select>
            提交时间：
            <input class="form-control js-bootstrap-date" name="start_time" id="start_time" value="{:input('request.start_time')}" aria-invalid="false" style="width: 110px;"> - 
            <input class="form-control js-bootstrap-date" name="end_time" id="end_time" value="{:input('request.end_time')}" aria-invalid="false" style="width: 110px;">
            用户ID：
            <input class="form-control" type="text" name="uid" style="width: 200px;" value="{:input('request.uid')}"
                   placeholder="用户ID">
            动态ID：
            <input class="form-control" type="text" name="dynamicid" style="width: 200px;" value="{:input('request.dynamicid')}"
                   placeholder="动态ID">
            动态所有者ID：
            <input class="form-control" type="text" name="touid" style="width: 200px;" value="{:input('request.touid')}"
                   placeholder="动态所有者ID">

            <input type="submit" class="btn btn-primary" value="搜索"/>
            <a class="btn btn-danger" href="{:url('Dynamicreport/index')}">清空</a>
        </form>
    
		<form method="post" class="js-ajax-form">
			<table class="table table-hover table-bordered">
				<thead>
					<tr>
						<th>ID</th>
						<th>举报用户</th>
						<th>动态所有者</th>
						<th>被举报动态ID</th>
						<th>举报内容</th>
						<th>状态</th>
						<th>提交时间</th>
						<th>处理时间</th>
						<th align="center">{:lang('ACTIONS')}</th>
					</tr>
				</thead>
				<tbody>
					<php>$status=array("0"=>"处理中","1"=>"已处理", "2"=>"审核失败");</php>
					<foreach name="list" item="vo">
					<tr>
						<td>{$vo['id']}</td>
						<td>{$vo['userinfo']['user_nickname']} ( {$vo['uid']} )</td>	
						<td>{$vo['touserinfo']['user_nickname']} ( {$vo['touid']} )</td>	
						<td>{$vo['dynamicid']}</td>
						<td><?php echo nl2br($vo['content']);?></td>
						<td>{$status[$vo['status']]}</td>
                        <td>{:date('Y-m-d H:i:s',$vo['addtime'])}</td>
                        <td>
							 <if condition="$vo['status'] eq '0'" >
								处理中
							 <else/>
								 {:date('Y-m-d H:i:s',$vo['uptime'])}
							 </if>						
						 </td>
						<td>
                            <if condition="$vo['status'] eq 0 ">
							 <!-- <a class="btn btn-xs btn-danger js-ajax-dialog-btn" href="{:url('Dynamic/setStatus',array('id'=>$vo['dynamicid']))}"  data-msg="确定要标记处理吗？">标记处理</a> -->
                            </if>
							<a class="btn btn-xs btn-info xiajia" data-id="{$vo['dynamicid']}">下架动态</a>
							<if condition="$vo['dynamic_type'] eq 2 ">
								<a class="btn btn-xs btn-success view" data-id="{$vo['dynamicid']}" >观看视频</a> 
							<elseif  condition="$vo['dynamic_type'] eq 1 "/>
								<a class="btn btn-xs btn-success" href='{:url("Dynamicreport/look",array("dynamicid"=>$vo["dynamicid"],"id"=>$vo["id"]))}'>查看图片</a>
							<elseif  condition="$vo['dynamic_type'] eq 3 "/>
								<a class="btn btn-xs btn-success playyy" data-id="{$vo['dynamicid']}" >播放语音</a>
							<else/>
							</if>
							<a class="btn btn-xs btn-danger js-ajax-delete" href="{:url('Dynamicreport/report_del',array('id'=>$vo['id']))}">{:lang('DELETE')}</a>
							
						</td>
					</tr>
					</foreach>
				</tbody>
			</table>
			<div class="pagination">{$page}</div>

		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
	<script src="__STATIC__/js/layer/layer.js"></script>



	<script type="text/javascript">
		$(function(){
		
		Wind.use('layer');
            $('.xiajia').click(function(){
                var _this=$(this);
                var id=_this.data('id');
                var value='';
                layer.prompt({
                    formType: 2,
                    title: '下架原因',
                    value: value,
                    area: ['800px', '100px'] //自定义文本域宽高
                }, function(value, index, elem){
                    $.ajax({
                        url:'{:url('dynamicreport/setXiajia')}',
                        type:'POST',
                        data:{id:id,reason:value},
                        dataType:'json',
                        success:function(data){
                            var code=data.code;
                            if(code==0){
                                layer.msg(data.msg);
								layer.closeAll();
                                reloadPage(window);
                                return !1;
                            }
                            layer.msg(data.msg,{},function(){
                                layer.closeAll();
                                reloadPage(window);
                            });
                            
                        },
                        error:function(){
                            layer.msg('操作失败，请重试');
                        }
                    });
                    
                });
                
            })
		
            $('.view').click(function(){
                var _this=$(this);
                var id=_this.data('id');
                layer.open({
                    type: 2,
                    title: '观看视频',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['500px', '750px'],
                    content: '/admin/dynamicreport/view?id='+id
                }); 
                
            });
			//播放语音
            $('.playyy').click(function(){
                var _this=$(this);
                var id=_this.data('id');
                layer.open({
                    type: 2,
                    title: '播放语音',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['400px', '250px'],
                    content: '/admin/Dynamic/playyy?id='+id
                }); 
                
            })
        })
	</script>
</body>
</html>